package com.fit.toysShop.pages;

import com.fit.toysShop.interfaces.Product;
import com.fit.toysShop.service.*;

import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;

public class ViewProduct {

	@Inject
	@Property
	private Products products;

	@Property
	private Product currentProduct;

	@InjectPage
	private ProductDetails productDetailsPage;

	@OnEvent(component = "productDetailsLink")
	public Object onShowDetails(String name) {
		Product chosenProduct = products.retrieveSingleProduct(name);
		productDetailsPage.setChosenProduct(chosenProduct);
		return productDetailsPage;
	}

}